package com.libui

import android.content.Context
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import com.libbase.Weak

class IconFonts {
    interface DataSource {
        val fontPath: String

        val iconFonts: Map<String, String>

        val iconNavigationBack: String
    }

    companion object {
        val instance: IconFonts by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            IconFonts()
        }
    }

    var dataSource: DataSource? by Weak()

    fun getIconFont(context: Context): Typeface? {
        val fontPath = dataSource?.fontPath ?: return null

        return Typeface.createFromAsset(context.assets, fontPath)
    }
}